﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Bootstrap.Admin.Query;
using Bootstrap.DataAccess;
using Bootstrap.DataAccess.Model;
using Longbow.Web.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace Bootstrap.Admin.Controllers.Handler
{

    /// <summary>
    /// Account controller.
    /// </summary>
    [Route("iifoxHandler/[controller]")]
    [ApiController]
    public class ActiveCallsController : ControllerBase
    {
        /// <summary>
        /// 活动呼叫
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        [HttpGet]
        public QueryData<ActiveCalls> Get([FromQuery]QueryActiveCallsOption value)
        {
            return value.RetrieveData();
        }






        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        [HttpPut]
        public bool Put([FromBody]ActiveCalls value)
        {
            
            ActiveCallsHelper.CallNum(value);
            return true;
        }


        /// <summary>
        /// 拆线or转入座席
        /// </summary>
        /// <param name="value"></param>
        [HttpPost]
        public bool Post([FromBody]ActiveCalls value)
        {
            return ActiveCallsHelper.SendAction(value);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpOptions]
        public string Options()
        {
            return null;
        }

    }
}

